<template>
  <div>
    <FortenVxetableStatic :data="dataList" :columns="columns" :maxHeight="maxHeight" pkName="tableName"
                          :searchFieldArr="['tableName', 'tableComment']"
                          searchPlaceholder="搜索表名、表说明"
                          :defaultSort="dbbackDefaultSort"
                          :buttonList="dbbackButtonList"
    ></FortenVxetableStatic>
  </div>
</template>

<script>
import FortenVxetableStatic from '@/components/common/FortenVxetableStatic.vue'

export default {
  name: 'roothelp',
  data() {
    return  {
      columns: [],
      maxHeight: window.innerHeight - 200,
      dataList: []
    }
  },
  components: {
    FortenVxetableStatic
  },
  methods: {
    //查询数据
    getData() {
      this.utilVue.loadShow(true)
      this.dataList = []
      this.$ajax.get('/sys/database/getTableInfo').then(response => {
        if (response.code == 0) {
          this.dataList = response.data
        }
        this.getColumns()
        this.utilVue.loadHide()
      })
    },
    //查询数据
    getColumns() {
      let class1Group = []
      let class1GroupKey = []
      this.dataList.forEach(item => {
        if (!class1GroupKey.includes(item.class1)) {
          class1Group.push({ label: item.class1, value: item.class1 })
          class1GroupKey.push(item.class1)
        }
      })
      this.columns = [
        {
          field: 'class1',
          title: '所属业务',
          titleHelp: '所属业务',
          sortable: true,
          filter: true,
          editRender: {
            name: 'ElSelect',
            options: class1Group,
            props: {placeholder: '请选择', filterable: true, clearable: true}
          }},
        {field: 'tableName', title: '表名', width: 180,  titleHelp: '表名', sortable: true},
        {field: 'tableComment', title: '表说明', titleHelp: '表说明', sortable: true},
        {field: 'createTime', title: '创建时间', width: 180, titleHelp: '创建时间', sortable: true},
        {field: 'updateTime', title: '更新时间', width: 180, titleHelp: '更新时间', sortable: true},
      ]
    }
  },
  props: [],
  created() {
    this.getData()
  },
  computed: {
  },
  mounted() {
  }
}
</script>

<style lang="scss" scoped>
</style>
